package com.zjl.spring.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.core.env.CommandLinePropertySource;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Auther: zhuangjl
 * @Date: 2021/12/30 10:37
 */
@Component
public class MyBean {

//    @Autowired
//    private CommandLinePropertySource commandLinePropertySource;

    public MyBean(ApplicationArguments args) {
//        boolean debug = args.containsOption("debug");
//        List<String> files = args.getNonOptionArgs();
//        if (debug) {
//            System.out.println(files);
//        }
//        String env = commandLinePropertySource.getProperty("env");
//        System.out.println(env);
        // if run with "--debug logfile.txt" prints ["logfile.txt"]
    }
}
